package com.riccardocardin.structured.concurrency.service;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.List;
import java.util.concurrent.ExecutionException;

import static com.riccardocardin.structured.concurrency.model.Model.*;

public class GitHubUserServiceImpl implements GitHubUserService {

    private static final Logger LOGGER = LoggerFactory.getLogger("GitHubApp");

    private final UserService userService;
    private final RepositoryService repositoryService;

    public GitHubUserServiceImpl(UserService userService, RepositoryService repositoryService) {
        this.userService = userService;
        this.repositoryService = repositoryService;
    }

    @Override
    public User findUser(UserId userId) throws InterruptedException, ExecutionException {
        return this.userService.findUser(userId);
    }

    @Override
    public List<Repository> findRepositories(UserId userId) throws InterruptedException, ExecutionException {
        return this.repositoryService.findRepositories(userId);
    }
}
